<%@ page import="com.bafa.objects.season.Season" %>
<%@ page import="com.bafa.objects.season.Division" %>
<%@ page import="com.bafa.objects.team.Team" %>
<%@ page import="com.bafa.objects.team.TeamSeasonStats" %>
<%@ page import="com.bafa.objects.team.TeamStats" %>
<%@ page import="com.bafa.objects.player.*" %>
<%@ page import="com.bafa.objects.*" %>
<%@ page import="com.bafa.middle.*" %>
<%@ page import="com.bafa.front.presentationbeans.*" %>
<%@ page import="java.util.*" %>
<%SiteBean siteBean = (SiteBean)session.getAttribute("SITEBEAN");%>

<% LeagueBean division = (LeagueBean)session.getAttribute("DIVISION");%>

    <% ResultsListBean results = (ResultsListBean)request.getAttribute("RECENTRESULTS");%>

    <% Report mainNews = (Report)request.getAttribute("MAINNEWS");%>

<% LeagueRulesBeans rules = (LeagueRulesBeans)session.getAttribute("LEAGUERULES");%>

    <% SeasonBean season = (SeasonBean)session.getAttribute("THISSEASON");   %>
	<% Division blankdivision = (Division)request.getAttribute("BLANKDIVISION");  
	AdminUser admin = null;%>






<style TYPE="text/css">
	<!--
	.TextScrollStyle {
		visibility:hidden;
		font-family:Verdana;
		font-weight:bold;
		text-align:center;
		padding:0;
		margin:0;
		width:100%;
		overflow:hidden;
	}

	-->
	</style>
	<script  src="script/niftycube.js" type="text/javascript" ></script>
	<script>
	NiftyLoad=function(){

		Nifty("ul#teamstandings h3","top");
		Nifty("ul#teamstandings div","bottom same-height");
		Nifty("ul#recentresults h3","top");
		Nifty("ul#recentresults div","bottom same-height");
		Nifty("ul#topscorer h3","top");
		Nifty("ul#topscorer div","bottom same-height");
		



}


</script>
<style type="text/css">
	
	
	
	ul#teamstandings,ul#teamstandings li{margin:0;padding:0;list-style:none}
	ul#teamstandings li{float:left;width:485px;margin:0 10px 10px 0}
	ul#teamstandings h3{font: bold  Verdana,sans-serif;
	    text-transform:uppercase;margin:0px;padding: 5px 0 3px;text-align:center}
	ul#teamstandings p{margin:0;padding:5px 8px 15px}
	ul#teamstandings div{background:#FFFFFF}
	li#teamstandings div{border:2px solid #D2D2D2}
	
	ul#recentresults,ul#recentresults li{margin:0;padding:0;list-style:none}
	ul#recentresults li{float:left;width:485px;margin:0 10px 10px 0}
	ul#recentresults h3{font: bold  Verdana,sans-serif;
	    text-transform:uppercase;margin:0px;padding: 5px 0 3px;text-align:center}
	ul#recentresults p{margin:0;padding:5px 8px 15px}
	ul#recentresults div{background:#FFFFFF}
	li#recentresults div{border:2px solid #D2D2D2}
	
	
	
	
	
	
</style>

<%if(blankdivision!=null){%>
<span class="lhsb">This cup tournament has no details</span>
<%}else if(division==null){%>

<%}else{%>

    <ul style="align:right" id="teamstandings">

 		<li id="teamstandings"><h3 class="avlh">Latest Team Standings -- Division <%=division.getDivisionId()%></h3>
    
    <div>
      
      <table  border="0" class="bafatablemedium">
        <tr>
          <td width="176">Name</td>
          <td width="26">P</td>
          <td width="26">W</td>
          <td width="26">D</td>
          <td width="26">L</td>
          <td width="26">F</td>
          <td width="26">A</td>
          <td width="25">GD</td>
          <td width="27">Pts</td>
          
        </tr>
		<%for(int i=0;i<division.teams().length;i++){
			LeaguePositionBean team = division.teams()[i];


		%>


			
		
        <%if(division.isCompleted()&&season.isLeague()&&team!=null){%>

        	<jsp:include page="completedhomeinclude.jsp" flush="true">
        		<jsp:param name="numRelegated" value="0" />
			<jsp:param name="numPromoted" value="0" />
			<jsp:param name="i" value="<%=i%>" />
			<jsp:param name="teamId" value="<%=team.getId()%>" />
			<jsp:param name="seasonId" value="<%=division.getSeasonId()%>" />
			<jsp:param name="teamName" value="<%=team.getName()%>" />
			<jsp:param name="played" value="<%=team.getGamesPlayed()%>" />
			<jsp:param name="won" value="<%=team.getWon()%>" />
			<jsp:param name="drawn" value="<%=team.getDrawn()%>" />
			<jsp:param name="lost" value="<%=team.getLost()%>" />
			<jsp:param name="for" value="<%=team.getGoalsFor()%>" />
			<jsp:param name="against" value="<%=team.getGoalsAgainst()%>" />
			<jsp:param name="goalDifference" value="<%=team.getGoalDifference()%>" />
			<jsp:param name="points" value="<%=team.getPoints()%>" />
        	</jsp:include>
         <%}else if(division.isCompleted()&&!season.isLeague()&&team!=null){%>
		 <jsp:include page="completedcupinclude.jsp" flush="true">
			<jsp:param name="numRelegated" value="0" />
			<jsp:param name="numPromoted" value="0" />
			<jsp:param name="i" value="<%=i%>" />
			<jsp:param name="teamId" value="<%=team.getId()%>" />
			<jsp:param name="seasonId" value="<%=division.getSeasonId()%>" />
			<jsp:param name="teamName" value="<%=team.getName()%>" />
			<jsp:param name="played" value="<%=team.getGamesPlayed()%>" />
			<jsp:param name="won" value="<%=team.getWon()%>" />
			<jsp:param name="drawn" value="<%=team.getDrawn()%>" />
			<jsp:param name="lost" value="<%=team.getLost()%>" />
			<jsp:param name="for" value="<%=team.getGoalsFor()%>" />
			<jsp:param name="against" value="<%=team.getGoalsAgainst()%>" />
			<jsp:param name="goalDifference" value="<%=team.getGoalDifference()%>" />
			<jsp:param name="points" value="<%=team.getPoints()%>" />
		</jsp:include>
		
        <%}else{%>
         <%if(team!=null){%>
        <tr class="r2">
          <td><A href="team.bafa?TeamId=<%=team.getId()%>&SeasonId=<%=division.getSeasonId()%>"><b><%=team.getName()%></b></A></td>
          <td><%=team.getGamesPlayed()%></td>
          <td><%=team.getWon()%></td>
	  <td><%=team.getDrawn()%> </td>
	  <td><%=team.getLost()%> </td>
	  <td><%=team.getGoalsFor()%> </td>
	<td><%=team.getGoalsAgainst()%> </td>
          <td><%=team.getGoalDifference()%></td>
         <td><%=team.getPoints()%></td>
          
        </tr><%}%>
		<%i++; %>

		<%if(i<division.teams().length){team = division.teams()[i];%>

        <tr class="r1">
          <td><A href="team.bafa?TeamId=<%=team.getId()%>&SeasonId=<%=division.getSeasonId()%>"><b><%=team.getName()%></b></A></td>
          <td><%=team.getGamesPlayed()%></td>
	            <td><%=team.getWon()%></td>
	  	  <td><%=team.getDrawn()%> </td>
	  	  <td><%=team.getLost()%> </td>
	  	  <td><%=team.getGoalsFor()%> </td>
	  	<td><%=team.getGoalsAgainst()%> </td>
	            <td><%=team.getGoalDifference()%></td>
         <td><%=team.getPoints()%></td>
        
        </tr>
		<%}}%>
	<%}%>
      </table>
	
	  
    </div>
    </li>
    </ul>
<%}%>
 
<%if(division!=null){%>
  	 <ul id="recentresults">
	  		<li id="recentresults"><h3 class="avlh">Recent Results</h3>
	     
    <div>
  		
  	      <table width="252" border="0" class="bafatablemedium">
  		  <%	if(results!=null&&results.matches().length>0){for(int j=results.matches().length-1;j>-1&&j>results.matches().length-4;j--){
  	%><%MatchBean match = results.matches()[j];%><%
if(match!=null){
  	String rowClass = "r2";
  	if(j%2==0) rowClass="r1";
     %>
              <tr class="<%=rowClass%>">
                <td><%=match.dayOfWeek()%> <%=match.day()%> <%=match.month()%></b></td>
                <td><b><a href="team.bafa?TeamId=<%=match.getTeamA()%>&SeasonId=<%=division.getSeasonId()%>"><%=match.getTeamAName()%></a></b></td>
  			<td><a href='viewmatchreport.bafa?matchId=<%=match.getID()%>'><%=match.getGoalsA()%> - <%=match.getGoalsB()%></a></td>
                <td><b><a href="team.bafa?TeamId=<%=match.getTeamB()%>&SeasonId=<%=division.getSeasonId()%>"><%=match.getTeamBName()%></a> </b></td>
              </tr>
  	 	<%}}}%>
  	 	<tr></tr>
          </table>
  	    </div>
  	    </li>
  	    </ul>
 

 

 

<%}%>







